package com.magpiebridge.service.Impl;


import com.magpiebridge.dao.NewsDao;
import com.magpiebridge.pojo.News;
import com.magpiebridge.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewsServiceImpl implements NewsService {

    @Autowired
    private NewsDao newsDao;

    @Override
    public List<News> getAllNews() {
        return newsDao.selectList(null);
    }

    @Override
    public News getNewsById(Integer id) {
        return newsDao.selectById(id);
    }

    @Override
    public int insertNews(News news) {
        return newsDao.insert(news);
    }

    @Override
    public int updateNews(News news) {
        return newsDao.updateById(news);
    }

    @Override
    public int deleteNews(Integer id) {
        return newsDao.deleteById(id);
    }
}
